finitializer.h File Reference

Global Initialization / Termination Mechanism. More...

#include "pluginterfaces/base/ftypes.h"

Data Structures

class  OneTimeProcedure
 Manager for initialization & termination code. More...

Namespaces

namespace  Steinberg

Defines

#define INIT_FUNCTION_NAME(name)   init##name
 Get a classes initialization procedure name.
#define INIT_FUNCTION(name)   bool INIT_FUNCTION_NAME(name) ()
 Use this to call an initialization procedure directly.
#define TERM_FUNCTION_NAME(name)   term##name
 Get a classes termination procedure name.
#define TERM_FUNCTION(name)   bool TERM_FUNCTION_NAME(name) ()
 Use this to call a termination procedure directly. Be aware that this does not unregister the procedure. It will be executed again, if terminate () is called !
#define INITIALIZE(name)
 Use this to register any initialization code.
#define INITIALIZE_LEVEL(name, level)
 Same as INITIALIZE(name), but utilizes initialization levels (see enum InitLevel).
#define TERMINATE(name)
 Use this to register any termination.
#define TERMINATE_LEVEL(name, level)
 Same as TERMINATE(name), but utilizes levels (see enum InitLevel).
#define FRIEND_INITIALIZE(name)   friend INIT_FUNCTION(name);
#define FRIEND_TERMINATE(name)   friend TERM_FUNCTION(name);
#define PRE_INITIALIZE(name)   INITIALIZE_LEVEL(name, kInitLevelFirst)
#define POST_INITIALIZE(name)   INITIALIZE_LEVEL(name, kInitLevelLast)

Typedefs

typedef bool(* InitTermFunc )()
 Initialization / Termination procedure format. There must not be parameters. Return true to indicate execution success. An initialization procedure returning false causes immediate initialization abort.

Enumerations

enum  InitLevel {
  kInitLevelFirst = 0, kInitLevelBelowStd = 25, kInitLevelStd = 50, kInitLevelAboveStd = 75,
  kInitLevelLast = 100
}
 

With init levels, you may initialize things in different places / at different program startup stages.

More...

Detailed Description

Global Initialization / Termination Mechanism.


Define Documentation

#define INIT_FUNCTION_NAME ( name   )     init##name

Get a classes initialization procedure name.

#define INIT_FUNCTION ( name   )     bool INIT_FUNCTION_NAME(name) ()

Use this to call an initialization procedure directly.

Be aware that this does not unregister the procedure. It will be executed again, if terminate () is called !

#define TERM_FUNCTION_NAME ( name   )     term##name

Get a classes termination procedure name.

#define TERM_FUNCTION ( name   )     bool TERM_FUNCTION_NAME(name) ()

Use this to call a termination procedure directly. Be aware that this does not unregister the procedure. It will be executed again, if terminate () is called !

#define INITIALIZE ( name   ) 
Value:
INIT_FUNCTION(name);                                \
	::Steinberg::OneTimeProcedure name##Initializer (true, INIT_FUNCTION_NAME(name), #name);     \
   INIT_FUNCTION(name)

Use this to register any initialization code.

The name parameter must be unique in the code (for example a class name). Example:

      INITIALIZE (MyViewController)
      {
      globalViewControllerRegistry->registerViewController(MyViewController::ClassId);
      }
#define INITIALIZE_LEVEL ( name,
level   ) 
Value:
INIT_FUNCTION(name);                                      \
	::Steinberg::OneTimeProcedure name##Initializer (true, INIT_FUNCTION_NAME(name), #name, level);    \
   bool init##name ()

Same as INITIALIZE(name), but utilizes initialization levels (see enum InitLevel).

#define TERMINATE ( name   ) 
Value:
TERM_FUNCTION(name);                                \
	::Steinberg::OneTimeProcedure name##Terminator (false, TERM_FUNCTION_NAME(name), #name);     \
   TERM_FUNCTION(name)

Use this to register any termination.

The name parameter must be unique in the code. Example:

     TERMINATE(MyViewController)
      {
      globalViewControllerRegistry->unregisterViewController(MyViewController::ClassId);
      }
#define TERMINATE_LEVEL ( name,
level   ) 
Value:
TERM_FUNCTION(name);                                      \
	::Steinberg::OneTimeProcedure name##Terminator (false, TERM_FUNCTION_NAME(name), #name, level);    \
   TERM_FUNCTION(name)

Same as TERMINATE(name), but utilizes levels (see enum InitLevel).

#define FRIEND_INITIALIZE ( name   )     friend INIT_FUNCTION(name);
#define FRIEND_TERMINATE ( name   )     friend TERM_FUNCTION(name);
#define PRE_INITIALIZE ( name   )     INITIALIZE_LEVEL(name, kInitLevelFirst)
#define POST_INITIALIZE ( name   )     INITIALIZE_LEVEL(name, kInitLevelLast)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.